<template>
  <section class="subscribe-service-box">
    <nav class="left-menu">
      <el-scrollbar class="el-scrollbar-x-hidden">
        <el-menu
          default-active="positionOpportunity"
          @select="handleMenuChange"
        >
          <el-submenu index="themeCenter">
            <template slot="title">
              <span>主题中心</span>
            </template>
            <el-menu-item index="positionOpportunity">职位机会</el-menu-item>
            <el-menu-item index="positionRecommend">岗位推荐</el-menu-item>
          </el-submenu>
          <el-menu-item index="subscribeRecord">
            <span slot="title">订阅记录</span>
          </el-menu-item>
        </el-menu>
      </el-scrollbar>
    </nav>
    <div class="right-content">
      <component :is="comName" :selectedRow="selectedRow"></component>
    </div>
  </section>
</template>

<script>
import ElanMenu from "@/components/ElanMenu";
export default {
  name: "SubscribeService",
  components: {
    ElanMenu,
    PositionSubscribe: () => import("./PositionSubscribe.vue"),
    PositionRecommend: () => import("./PositionRecommend.vue"),
    SubscribeRecord: () => import("./SubscribeRecord.vue"),
  },
  props: {
    selectedRow: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      comName: "PositionSubscribe",
      activeMenuIndex: "1",
      menuList: [
        { title: "职位机会", value: "1" },
        { title: "岗位推荐", value: "2" },
        { title: "订阅记录", value: "3" },
      ],
    };
  },
  methods: {
    handleMenuChange(val) {
      this.activeMenuIndex = val;
      switch (val) {
        case "positionOpportunity":
          this.comName = "PositionSubscribe";
          break;
        case "positionRecommend":
          this.comName = "PositionRecommend";
          break;
        case "subscribeRecord":
          this.comName = "SubscribeRecord";
          break;
        default:
          break;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.subscribe-service-box {
  width: 100%;
  display: flex;
  .left-menu {
    flex-basis: 145px;
    background: #f0f2f5;
  }
  .right-content {
    padding-top: 12px;
    flex: 1;
    padding: 0 0px 17px 21px;
    overflow: auto;
  }
}
::v-deep .el-menu {
  width: 145px;
  border-right: 0px;
  background: #f0f2f5;
}

::v-deep .el-submenu__title {
  font-size: 16px;
  color: #8892a6;
  display: flex;
  align-items: center;
  padding-left: 26px !important;
}

::v-deep .el-menu-item {
  position: relative;
  padding-left: 26px !important;
  padding: 0;
  min-width: 145px;
  height: 41px;
  line-height: 41px;
  color: #8892a6;
  // overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
}

::v-deep .el-menu-item.is-active {
  color: #fff;
  padding-left: 9px !important;
  margin-left: 12px;
  background: #7052ff;
  border-radius: 8px;
  min-width: 133px;
  font-weight: 400;
  &::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 41px;
    background: #7052ff;
    position: absolute;
    left: -12px;
    border-radius: 8px;
    z-index: 100;
  }
}
</style>
